package cn.zeal4j;

import java.util.Date;

/**
 * @author Administrator
 * @file Java-StandardEdition-Review
 * @create 2020 09 30 10:45
 */
public class Operator {
    public static void main(String[] args) {

        // 赋值操作
        int varA = 132432;
        double varB = 23323.22;

        // 联动赋值操作
        int a, b, c;
        a = b = c = 1;

        // 加减乘除取模
        System.out.println( (varA + varB) + " type is -> " + DataType.typeOf(varA + varB));
        System.out.println( (varA - varB) + " type is -> " + DataType.typeOf(varA - varB));
        System.out.println( (varA * varB) + " type is -> " + DataType.typeOf(varA * varB));
        System.out.println( (varA / varB) + " type is -> " + DataType.typeOf(varA / varB));
        System.out.println( (varA % varB) + " type is -> " + DataType.typeOf(varA % varB));

        System.out.println("- - - - 这是分割线 - - - -");

        // 自运算
        a = a ++;
        b = -- b;

        // 比较
        System.out.println( (varA < varB) + " type is -> " + DataType.typeOf(varA < varB));
        System.out.println( (varA > varB) + " type is -> " + DataType.typeOf(varA > varB));
        System.out.println( (varA == varB) + " type is -> " + DataType.typeOf(varA == varB));
        System.out.println( (varA != varB) + " type is -> " + DataType.typeOf(varA != varB));
        System.out.println( (varA <= varB) + " type is -> " + DataType.typeOf(varA <= varB));
        System.out.println( (varA >= varB) + " type is -> " + DataType.typeOf(varA >= varB));

        System.out.println("- - - - 这是分割线 - - - -");

        // 且 - 或 - 非
        boolean flag1 = true, flag2 = false, flag3 = true, flag4 = false;
        // 单项比较
        boolean answer1 = flag1 && flag2;
        boolean answer2 = flag1 || flag2;
        boolean answer3 = !flag1;


        System.out.println(answer1);
        System.out.println(answer2);
        System.out.println(answer3);

        System.out.println("- - - - 这是分割线 - - - -");

        // 连续比较
        boolean answer4 = flag1 && flag2 && flag3 && flag4;
        boolean answer5 = flag1 || flag2 || flag3 || flag4;
        System.out.println(answer4);
        System.out.println(answer5);

        System.out.println("- - - - 这是分割线 - - - -");

        // 长短路区别？
        int aa = 1;
        int bb = 1;
        boolean answer6 = false &  aa++ == 1;
        System.out.println(aa);
        boolean answer7 = false && bb++ == 1 ;
        System.out.println(bb);

        // 三目运算
        int trinomialOperation = 10 > a ? 100 : 200;


        // 位运算，有兴趣自行了解
    }
}
